<!doctype html>
<html lang="en">
<head>
    <title>登录到ranter水果店</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="css/bootstrap.css">
    <style>
        .form-group-lg .form-control{
            height: 30px;
            font-size: 12px;
        }
        .container{
            margin-top: 4%;
        }
        .row{
            padding-left: 20%;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="row" id="regiter">
        <h2>新用户注册信息</h2>
        <form class="form-horizontal" method="post" >
            <div class="form-group form-group-lg">
                <label class="col-sm-2 control-label" for="formGroupInputLarge">用户名</label>
                <div class="col-sm-2">
                    <input name="UserName" class="form-control" type="text" id="formGroupInputLarge" placeholder="请输入新用户名称">
                </div>
            </div>
            <div class="form-group form-group-lg">
                <label class="col-sm-2 control-label" for="formGroupInputLarge">密码</label>
                <div class="col-sm-2">
                    <input name="PassWord" class="form-control" type="password" id="formGroupInputLarge" placeholder="请输入新用户密码">
                </div>
            </div>
            <div class="form-group form-group-lg">
                <label class="col-sm-2 control-label" for="formGroupInputLarge">联系方式</label>
                <div class="col-sm-4">
                    <input name="telephone" class="form-control" type="text" id="formGroupInputSmall" placeholder="请输入联系方式">
                </div>
            </div>
            <div class="form-group form-group-lg">
                <label class="col-sm-2 control-label" for="formGroupInputLarge">收货地址</label>
                <div class="col-sm-4">
                    <input name="address" class="form-control" type="text" id="formGroupInputSmall" placeholder="请设置收货地址">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button id="tijiao" type="button" class="btn btn-success">提交新用户注册信息</button>
                </div>
            </div>
        </form>
    </div>
</div>

<script src="js/jquery-3.2.0.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>-->
<script src="js/bootstrap.js"></script>

<script>
    $("#tijiao").click(function(){
        $.post('/tijiao',{
            "UserName" : $("[name='UserName']").val(),
            "PassWord" : $("[name='PassWord']").val(),
            "telephone" : $("[name='telephone']").val(),
            "address" : $("[name='address']").val()
        },function(result){
            if(result == "1"){
                alert("提交成功");
                window.location.href="/login";
            }else{
                alert("用户名已存在，请更换用户名")
            }
        });
    })
</script>
</body>
</html>